var t = getApp();

Page({
    data: {
        id: "",
        name: "",
        mobile: "",
        nickName: "",
        uid: "",
        kFootshow: !0,
        fromStatus: !1
    },
    onLoad: function(i) {
        if (i.id && this.setData({
            id: i.id
        }), i.scene) {
            var a = decodeURIComponent(i.scene);
            if (a) {
                var e = [];
                e = a.split(",");
                for (var n = 0; n < e.length; n++) {
                    var o;
                    "mid" == (o = e[n].split("="))[0] && t._setMid(o[1]), "id" == o[0] && this.setData({
                        id: o[1]
                    });
                }
            }
        }
        this.test(), this.getData();
    },
    tabrshowbtn: function(t) {
        t.detail && this.setData({
            kFootshow: !1
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    test: function() {
        var i = t.getNetAddresss("plugin.activity-apply.api.Activity.getActivityEnrol");
        t._getNetWork({
            url: i,
            data: {
                activity_id: this.data.id
            },
            success: function(t) {
                var i = t.data;
                1 == i.result || wx.showToast({
                    title: i.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getData: function() {
        var i = t.getNetAddresss("plugin.activity-apply.api.Activity.getActivity"), a = this;
        t._getNetWork({
            url: i,
            data: {
                activity_id: a.data.id
            },
            success: function(t) {
                var i = t.data;
                1 == i.result ? (1 == i.data.pay_order.sign && a.setData({
                    fromStatus: !0
                }), a.setData({
                    name: i.data.title,
                    nickName: i.data.member.nickname,
                    mobile: i.data.member.mobile,
                    uid: i.data.member.uid
                })) : wx.showToast({
                    title: i.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    submit: function() {
        var i = {
            activity_id: this.data.id,
            member_id: this.data.uid
        }, a = this, e = t.getNetAddresss("plugin.activity-apply.api.activity.saveSign");
        t._getNetWork({
            url: e,
            data: i,
            success: function(t) {
                var i = t.data;
                1 == i.result ? (wx.showToast({
                    title: i.msg,
                    icon: "none",
                    duration: 1e3
                }), a.getData()) : wx.showToast({
                    title: i.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});